#========================================
#    author: Changlong.Zang
#      mail: zclongpop123@163.com
#      time: Tue Apr 18 12:08:31 2017
#========================================
try:
    from PyQt5 import QtCore, QtGui, QtWidgets

except ImportError:
    from PyQt4 import QtCore, QtGui
    QtWidgets = QtGui
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
class KeyDelegate(QtWidgets.QStyledItemDelegate):
    '''
    '''
    Key_Icon = QtGui.QPixmap(':/icon/icons/st_bullet_orange.png').scaled(22, 22)
    Nul_Icon = QtGui.QPixmap()

    def __init__(self, parent=None):
        '''
        '''
        super(KeyDelegate, self).__init__(parent)





    def createEditor(self, parent, option, index):
        '''
        '''
        lab = QtWidgets.QLabel(parent)
        lab.setAlignment(QtCore.Qt.AlignCenter)
        return lab





    def setEditorData(self, editor, index):
        '''
        '''
        value = index.data(QtCore.Qt.EditRole)

        if value.toInt()[1]:
            editor.setPixmap(self.Key_Icon)
        else:
            editor.setPixmap(self.Nul_Icon)
